package com.gw.smscheck.service.business.statistic.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gw.smscheck.dao.business.statistic.JzfdStreamPeopleStatisticsMapper;
import com.gw.smscheck.entity.business.statistic.JzfdStreamPeopleStatistics;
import com.gw.smscheck.service.business.statistic.JzfdStreamPeopleStatisticsService;
import com.gw.smscheck.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class JzfdStreamPeopleStatisticsServiceImpl implements JzfdStreamPeopleStatisticsService {

    @Autowired
    private JzfdStreamPeopleStatisticsMapper statisticsMapper;

    @Override
    public List<JzfdStreamPeopleStatistics> findAll() {
        return statisticsMapper.findAll();
    }

    @Override
    public PageInfo<JzfdStreamPeopleStatistics> pageSelect(JzfdStreamPeopleStatistics dto) {
        PageHelper.startPage(dto.getPage(), dto.getRows(), "create_time desc");// 排序
        List<JzfdStreamPeopleStatistics> resultList = statisticsMapper.pageSelect(dto);
        PageInfo<JzfdStreamPeopleStatistics> pageInfo = new PageInfo<>(resultList);
        return pageInfo;
    }

    @Override
    public JzfdStreamPeopleStatistics findCurrent(JzfdStreamPeopleStatistics dto) {
        // String day = DateUtil.getCurrDate("yyyy-MM-dd");
        dto.setCalledDate(DateUtil.getCurrDate("yyyy-MM-dd"));
        dto.setNowTime(DateUtil.getCurrDate("HH:mm:ss"));
        return statisticsMapper.findByModal(dto);
    }

    @Override
    public JzfdStreamPeopleStatistics findByModal(JzfdStreamPeopleStatistics dto) {
        dto.setNowTime(DateUtil.getCurrDate("HH:mm:ss"));
        return statisticsMapper.findByModal(dto);
    }
}
